package edu.pku.hawk.controller.util;

import java.io.Serializable;
import java.util.LinkedList;

public class RegionPath implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6077430545670184426L;
	public LinkedList<RegionPoint> path = new LinkedList<RegionPoint>();
	private final int Path_Max = 5;
	public int sensorType;
	public int objType;

	public RegionPath () {
	}
	
	public RegionPath ( int sensorType) {
		this.sensorType = sensorType;
	}
	
	public boolean isEmpty () {
		return path.size() == 0;
	}
	
	public RegionPoint getLast() {
		if (path.size() <= 0)
			return null;
		else
			return path.get(path.size() - 1);
	}

	public RegionPoint getFirst() {
		if (path.size() <= 0)
			return null;
		else
			return path.get(0);
	}

	public void add(RegionPoint p) {
		path.add(p);
		if (path.size() > Path_Max) 
			path.remove();
	}

	public void clear() {
		path.clear();
	}
}
